<!DOCTYPE html>
<html lang="en-US">
  <head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1">
    <title>小程序开发月刊第14期（20200314） | 被删的前端游乐场</title>
    <meta name="generator" content="VuePress 1.8.2">
    
    <meta name="description" content="Just playing around">
    
    <link rel="preload" href="/front-end-playground/assets/css/0.styles.6ad2a9ca.css" as="style"><link rel="preload" href="/front-end-playground/assets/js/app.1e2670bf.js" as="script"><link rel="preload" href="/front-end-playground/assets/js/2.38d016d1.js" as="script"><link rel="preload" href="/front-end-playground/assets/js/3.e3f029cb.js" as="script"><link rel="preload" href="/front-end-playground/assets/js/170.c1dc065a.js" as="script">
    <link rel="stylesheet" href="/front-end-playground/assets/css/0.styles.6ad2a9ca.css">
  </head>
  <body>
    <div id="app" data-server-rendered="true"><div class="theme-container"><header class="navbar"><div class="sidebar-button"><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" role="img" viewBox="0 0 448 512" class="icon"><path fill="currentColor" d="M436 124H12c-6.627 0-12-5.373-12-12V80c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12zm0 160H12c-6.627 0-12-5.373-12-12v-32c0-6.627 5.373-12 12-12h424c6.627 0 12 5.373 12 12v32c0 6.627-5.373 12-12 12z"></path></svg></div> <a href="/front-end-playground/" class="home-link router-link-active"><!----> <span class="site-name">被删的前端游乐场</span></a> <div class="links"><div class="search-box"><input aria-label="Search" autocomplete="off" spellcheck="false" value=""> <!----></div> <nav class="nav-links can-hide"><div class="nav-item"><a href="/front-end-playground/" class="nav-link">概述</a></div><div class="nav-item"><a href="/front-end-playground/front-end-basic/" class="nav-link">前端领域</a></div><div class="nav-item"><a href="/front-end-playground/vue/" class="nav-link">Vue学习</a></div><div class="nav-item"><a href="/front-end-playground/wxapp/" class="nav-link router-link-active">小程序学习</a></div><div class="nav-item"><a href="/front-end-playground/front-end-others/" class="nav-link">百家齐放</a></div><div class="nav-item"><a href="/front-end-playground/front-end-addon/" class="nav-link">前端的进击</a></div><div class="nav-item"><a href="/front-end-playground/front-end-work/" class="nav-link">前端与工作</a></div><div class="nav-item"><a href="/front-end-playground/faq.html" class="nav-link">FAQ</a></div> <a href="https://github.com/godbasin/front-end-playground" target="_blank" rel="noopener noreferrer" class="repo-link">
    Github
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav></div></header> <div class="sidebar-mask"></div> <aside class="sidebar"><nav class="nav-links"><div class="nav-item"><a href="/front-end-playground/" class="nav-link">概述</a></div><div class="nav-item"><a href="/front-end-playground/front-end-basic/" class="nav-link">前端领域</a></div><div class="nav-item"><a href="/front-end-playground/vue/" class="nav-link">Vue学习</a></div><div class="nav-item"><a href="/front-end-playground/wxapp/" class="nav-link router-link-active">小程序学习</a></div><div class="nav-item"><a href="/front-end-playground/front-end-others/" class="nav-link">百家齐放</a></div><div class="nav-item"><a href="/front-end-playground/front-end-addon/" class="nav-link">前端的进击</a></div><div class="nav-item"><a href="/front-end-playground/front-end-work/" class="nav-link">前端与工作</a></div><div class="nav-item"><a href="/front-end-playground/faq.html" class="nav-link">FAQ</a></div> <a href="https://github.com/godbasin/front-end-playground" target="_blank" rel="noopener noreferrer" class="repo-link">
    Github
    <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></nav>  <ul class="sidebar-links"><li><section class="sidebar-group collapsable depth-0" style="padding-top:;"><!----> <p class="sidebar-heading"><span>小程序原理</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0" style="padding-top:;"><!----> <p class="sidebar-heading"><span>小程序开发技巧</span> <span class="arrow right"></span></p> <!----></section></li><li><section class="sidebar-group collapsable depth-0" style="padding-top:10px;"><div class="kitty-main" data-v-2b653b36><span class="stand" data-v-2b653b36></span> <div class="cat" data-v-2b653b36><div class="body" data-v-2b653b36></div> <div class="head" data-v-2b653b36><div class="ear" data-v-2b653b36></div> <div class="ear" data-v-2b653b36></div></div> <div class="face" data-v-2b653b36><div class="nose" data-v-2b653b36></div> <div class="whisker-container" data-v-2b653b36><div class="whisker" data-v-2b653b36></div> <div class="whisker" data-v-2b653b36></div></div> <div class="whisker-container" data-v-2b653b36><div class="whisker" data-v-2b653b36></div> <div class="whisker" data-v-2b653b36></div></div></div> <div class="tail-container" data-v-2b653b36><div class="tail" data-v-2b653b36><div class="tail" data-v-2b653b36><div class="tail" data-v-2b653b36><div class="tail" data-v-2b653b36><div class="tail" data-v-2b653b36><div class="tail" data-v-2b653b36><div class="tail" data-v-2b653b36></div></div></div></div></div></div></div></div></div></div> <p class="sidebar-heading open"><span>小程序开发月刊</span> <span class="arrow down"></span></p> <ul class="sidebar-links sidebar-group-items"><li><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20190114.html" class="sidebar-link">小程序开发月刊第一期（20190114）</a></li><li><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20190215.html" class="sidebar-link">小程序开发月刊第二期（20190215）</a></li><li><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20190315.html" class="sidebar-link">小程序开发月刊第三期（20190315）</a></li><li><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20190415.html" class="sidebar-link">小程序开发月刊第四期（20190415）</a></li><li><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20190515.html" class="sidebar-link">小程序开发月刊第五期（20190515）</a></li><li><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20190617.html" class="sidebar-link">小程序开发月刊第六期（20190617）</a></li><li><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20190715.html" class="sidebar-link">小程序开发月刊第七期（20190715）</a></li><li><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20190815.html" class="sidebar-link">小程序开发月刊第八期（20190815）</a></li><li><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20190916.html" class="sidebar-link">小程序开发月刊第九期（20190916）</a></li><li><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20191015.html" class="sidebar-link">小程序开发月刊第十期（20191015）</a></li><li><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20191115.html" class="sidebar-link">小程序开发月刊第11期（20191115）</a></li><li><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20191216.html" class="sidebar-link">小程序开发月刊第12期（20191216）</a></li><li><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20200214.html" class="sidebar-link">小程序开发月刊第13期（20200214）</a></li><li><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20200314.html" aria-current="page" class="active sidebar-link">小程序开发月刊第14期（20200314）</a><ul class="sidebar-sub-headers"><li class="sidebar-sub-header"><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20200314.html#这个月大家都开始陆陆续续回去上班了-远程办公的环境也有了一大突破-线上会议的各种延迟和回音有时候依然让人尴尬。不过情况已经慢慢好转-希望各位的日子也会越来越好。" class="sidebar-link">这个月大家都开始陆陆续续回去上班了，远程办公的环境也有了一大突破，线上会议的各种延迟和回音有时候依然让人尴尬。不过情况已经慢慢好转，希望各位的日子也会越来越好。</a></li><li class="sidebar-sub-header"><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20200314.html#title-小程序开发月刊第14期-20200314-date-2020-03-14-20-46-50categories-小程序双皮奶tags-教程" class="sidebar-link">title: 小程序开发月刊第14期（20200314）
date: 2020-03-14 20:46:50
categories: 小程序双皮奶
tags: 教程</a></li><li class="sidebar-sub-header"><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20200314.html#小程序能力" class="sidebar-link">小程序能力</a></li><li class="sidebar-sub-header"><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20200314.html#小程序·云开发" class="sidebar-link">小程序·云开发</a></li><li class="sidebar-sub-header"><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20200314.html#开发者工具" class="sidebar-link">开发者工具</a></li><li class="sidebar-sub-header"><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20200314.html#社区精选文章" class="sidebar-link">社区精选文章</a></li><li class="sidebar-sub-header"><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20200314.html#最新踩坑-tips" class="sidebar-link">最新踩坑 &amp;&amp; Tips</a></li><li class="sidebar-sub-header"><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20200314.html#结束语" class="sidebar-link">结束语</a></li></ul></li><li><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20200415.html" class="sidebar-link">小程序开发月刊第15期（20200415）</a></li></ul></section></li></ul> </aside> <main class="page"> <div class="theme-default-content content__default"><h2 id="这个月大家都开始陆陆续续回去上班了-远程办公的环境也有了一大突破-线上会议的各种延迟和回音有时候依然让人尴尬。不过情况已经慢慢好转-希望各位的日子也会越来越好。"><a href="#这个月大家都开始陆陆续续回去上班了-远程办公的环境也有了一大突破-线上会议的各种延迟和回音有时候依然让人尴尬。不过情况已经慢慢好转-希望各位的日子也会越来越好。" class="header-anchor">#</a> 这个月大家都开始陆陆续续回去上班了，远程办公的环境也有了一大突破，线上会议的各种延迟和回音有时候依然让人尴尬。不过情况已经慢慢好转，希望各位的日子也会越来越好。
</h2> <h2 id="title-小程序开发月刊第14期-20200314-date-2020-03-14-20-46-50categories-小程序双皮奶tags-教程"><a href="#title-小程序开发月刊第14期-20200314-date-2020-03-14-20-46-50categories-小程序双皮奶tags-教程" class="header-anchor">#</a> title: 小程序开发月刊第14期（20200314）
date: 2020-03-14 20:46:50
categories: 小程序双皮奶
tags: 教程</h2> <p>这个月大家都开始陆陆续续回去上班了，远程办公的环境也有了一大突破，线上会议的各种延迟和回音有时候依然让人尴尬。不过情况已经慢慢好转，希望各位的日子也会越来越好。
</p> <h1 id="小程序-latest"><a href="#小程序-latest" class="header-anchor">#</a> 小程序 latest</h1> <h2 id="小程序能力"><a href="#小程序能力" class="header-anchor">#</a> 小程序能力</h2> <h3 id="安卓微信7-0-12"><a href="#安卓微信7-0-12" class="header-anchor">#</a> 安卓微信7.0.12</h3> <p>本次小程序更新概要如下:</p> <ul><li>小程序启动耗时优化，请关注小程序启动是否受影响；</li> <li>菜单增加“重新进入小程序”入口，请关注重启后是否正常；</li> <li>解决 connectWifi android 10下失败的问题；</li> <li>文件接口 readFile 改动，请关注功能是否正常。</li></ul> <h2 id="小程序·云开发"><a href="#小程序·云开发" class="header-anchor">#</a> 小程序·云开发</h2> <h3 id="小程序·云开发支持数据库回档"><a href="#小程序·云开发支持数据库回档" class="header-anchor">#</a> 小程序·云开发支持数据库回档</h3> <p>从开发者工具1.02.202002282版本开始，云开发提供了数据库回档功能。系统会自动开启数据库备份，并于每日凌晨自动进行一次数据备份，最长保存 7 天的备份数据。如有需要，开发者可在云控制台上通过新建回档任务将集合回档（还原）至指定时间点。
回档期间，数据库的数据访问不受影响。回档完成后，开发者可在集合列表中看到原有数据库集合和回档后的集合。</p> <ul><li>详细功能介绍请参考文档<a href="https://developers.weixin.qq.com/miniprogram/dev/wxcloud/guide/database/backup.html" target="_blank" rel="noopener noreferrer">《数据库回档》<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <h3 id="小程序·云开发支持按量付费"><a href="#小程序·云开发支持按量付费" class="header-anchor">#</a> 小程序·云开发支持按量付费</h3> <p>为助力开发者以更低的资源成本实现小程序的功能迭代，从开发者工具1.02.2003022版本开始，小程序·云开发新增按量付费功能。在按量付费模式下，系统每月会提供一定的免费额度供开发者使用，超过免费额度的资源消耗将按照对应的刊例价扣除费用。</p> <ul><li>具体按量付费计费策略请参考文档<a href="https://developers.weixin.qq.com/miniprogram/dev/wxcloud/billing/postpayment.html" target="_blank" rel="noopener noreferrer">《小程序·云开发按量付费》<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <p>按量付费功能适用于：</p> <ul><li>对于无法准确预估资源使用量的小程序，按量付费功能在保证了正常资源使用的同时，也避免了当用户访问量突增时，由于资源储备不足所导致的超限停服等问题；</li> <li>对于仅使用部分云开发资源类型的小程序，按量付费功能按消耗收费的模式将极大地降低资源成本。</li></ul> <p>开发者可通过登录微信开发者工具的云开发控制台，在环境设置中直接开通按量付费功能。</p> <h2 id="开发者工具"><a href="#开发者工具" class="header-anchor">#</a> 开发者工具</h2> <h3 id="代码编译和上传-ci-模块"><a href="#代码编译和上传-ci-模块" class="header-anchor">#</a> 代码编译和上传 CI 模块</h3> <p><a href="https://www.npmjs.com/package/miniprogram-ci" target="_blank" rel="noopener noreferrer">miniprogram-ci<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a> 是从微信开发者工具中抽离的关于小程序/小游戏项目代码的编译模块。该npm 模块，封装了以下逻辑：</p> <ul><li>对源代码进行校验</li> <li>对源代码进行预编译</li> <li>使用证书生成签名</li> <li>上传</li></ul> <p>使用前需要使用小程序管理员身份访问&quot;微信公众平台-开发-开发设置&quot;后下载代码上传密钥，并配置 IP 白名单（可选，需要注意风险），才能进行上传、预览操作。</p> <ul><li><a href="https://developers.weixin.qq.com/miniprogram/dev/devtools/ci.html" target="_blank" rel="noopener noreferrer">参考文档地址<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <h3 id="微信开发者工具提供-api-mock-能力"><a href="#微信开发者工具提供-api-mock-能力" class="header-anchor">#</a> 微信开发者工具提供 API Mock 能力</h3> <p>为了方便开发者进行功能开发和调试，从 1.02.202003062 版本开始，微信开发者工具提供 API Mock 功能，可模拟如wx.request 、wx.downloadFile 以及 wx.getBackgroundFetchData 等API 的调用结果，极大地降低了小程序的开发成本。</p> <ul><li>详细功能介绍请参考文档<a href="https://developers.weixin.qq.com/miniprogram/dev/devtools/api-mock.html" target="_blank" rel="noopener noreferrer">《API Mock》<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <p>API Mock 功能可覆盖的应用场景包括但不限于：</p> <ul><li>模拟特定用户场景数据，如通过配置 wx.getLocation 的返回数据，从而模拟位置信息；</li> <li>模拟各类异常情况，如通过配置wx.request的回调为 fail，从而模拟网络异常；</li> <li>模拟部分微信开发者工具中暂不支持调试的 API，如发票相关的 wx.chooseInvoic等接口。</li> <li>开发者可通过登录微信开发者工具，在调试器的 Mock 面板中使用该功能。</li></ul> <h3 id="更多更新说明"><a href="#更多更新说明" class="header-anchor">#</a> 更多更新说明</h3> <p>参考<a href="https://developers.weixin.qq.com/community/develop/doc/0004064f12424003b90a1758f56c01" target="_blank" rel="noopener noreferrer">微信开发者工具 1.02.2003121 RC 更新说明<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>，这期新增能力包括：</p> <ol><li>支持 API Mock。</li> <li>编辑器支持重命名多个文件。</li> <li>支持显示灰度中的基础库、下发测试基础库（该功能只能推送到登录到开发者工具的微信号的手机上，会影响到手机上所有的小程序）。</li></ol> <ul><li>新增显示灰度中的基础库以及基础库支持的客户端版本。</li> <li>同时新增推送按钮，将选定版本的基础库下发到客户端上，推送结果可以在开发版小程序的调试面板中查看。</li> <li>微信客户端对开发版的小程序打开调试，可以看到测试版基础库的生效时间。</li></ul> <ol start="4"><li>模拟器支持终止。</li></ol> <ul><li>模拟器是工具的主要功能之一，如果小程序/小游戏的业务代码中出现死循环、复杂运算、频繁调用某些 API 的情况下都会导致工具出现卡顿或者 CPU 占用比较高的情况。模拟器新增终止按钮，点击后可以暂时终止模拟器运行，节省系统资源占用。</li></ul> <ol start="5"><li>打开项目时展示 Loading 状态。
工具增加开启加载 loading 弹窗，显示加载状态情况。</li> <li>CLI/HTTP V2 更新。</li></ol> <ul><li>CLI &amp; HTTP 接口升级 v2 版本，在 v2 版本中，旧版命令仍然可以使用，但已废弃并会在未来移除，请使用 v2 命令。v2 版本增加了云开发管理操作支持、优化命令形式、增加细致状态提示、支持长时间命令执行、支持国际化（中英文选择）等。详细文档。</li></ul> <ol start="7"><li>优化云控制台用户访问统计和监控图表的数据展示。
支持按照近 7 天、近 30 天以及自定义时间段来筛选 DAU。</li> <li>数据库备份回档。</li></ol> <p>更多的内容可以查看：</p> <ul><li><a href="https://developers.weixin.qq.com/miniprogram/dev/devtools/stable.html" target="_blank" rel="noopener noreferrer">稳定版 Stable Build 更新日志<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://developers.weixin.qq.com/miniprogram/dev/devtools/nightly.html" target="_blank" rel="noopener noreferrer">开发版 Nightly Build 更新日志<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <h1 id="小程序教程"><a href="#小程序教程" class="header-anchor">#</a> 小程序教程</h1> <h2 id="社区精选文章"><a href="#社区精选文章" class="header-anchor">#</a> 社区精选文章</h2> <ul><li><a href="https://developers.weixin.qq.com/community/develop/article/doc/000240bb188098d767f9b299956013" target="_blank" rel="noopener noreferrer">[填坑手册]小程序新版订阅消息+云开发实战与跳坑<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://developers.weixin.qq.com/community/develop/article/doc/0006245c108bf0cd56e9da13651813" target="_blank" rel="noopener noreferrer">业务数据怎么查，我用云开发高级日志服务<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://developers.weixin.qq.com/community/develop/article/doc/00080c6e3746d8a940f9b43e55fc13" target="_blank" rel="noopener noreferrer">只有三行代码的神奇云函数的功能之一：获取openid<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li> <li><a href="https://developers.weixin.qq.com/community/develop/article/doc/000c6c23708fe0ad46e9dcd215b013" target="_blank" rel="noopener noreferrer">借助云开发实现小程序订阅消息和模板消息的推送功能<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></li></ul> <p>往期内容可以查看<a href="https://developers.weixin.qq.com/community/develop/article" target="_blank" rel="noopener noreferrer">文章分享<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a></p> <h2 id="最新踩坑-tips"><a href="#最新踩坑-tips" class="header-anchor">#</a> 最新踩坑 &amp;&amp; Tips</h2> <h3 id="【同步踩坑信息】-云函数"><a href="#【同步踩坑信息】-云函数" class="header-anchor">#</a> 【同步踩坑信息】- 云函数</h3> <p>1、小程序冷启动可能导致无状态云函数变成有状态
2、避免使用<code>setTimeout</code>等异步调用，而应使用明确状态管理的<code>await</code>或<code>Promise</code>
3、避免使用<code>cloud.getWXContext()</code>，而使用<code>cloud.getWXContext(context)</code>代替
4、用到<code>Date</code>对象的函数应当设置时区环境变量，TZ=Asia/Shanghai</p> <h2 id="结束语"><a href="#结束语" class="header-anchor">#</a> 结束语</h2> <p>如果你也使用Typescript的话，不妨看看我用各种踩坑经验整理的这个<a href="https://github.com/godbasin/wxapp-typescript-demo" target="_blank" rel="noopener noreferrer">小程序 typescript 最佳实践 demo<span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></a>。</p></div> <!----> <footer class="page-edit"><div class="edit-link"><a href="https://github.com/godbasin/front-end-playground/edit/sourcecode/docs/wxapp/wxapp-latest/wxapp-latest-20200314.md" target="_blank" rel="noopener noreferrer">帮阿猪改善此页面！</a> <span><svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false" x="0px" y="0px" viewBox="0 0 100 100" width="15" height="15" class="icon outbound"><path fill="currentColor" d="M18.8,85.1h56l0,0c2.2,0,4-1.8,4-4v-32h-8v28h-48v-48h28v-8h-32l0,0c-2.2,0-4,1.8-4,4v56C14.8,83.3,16.6,85.1,18.8,85.1z"></path> <polygon fill="currentColor" points="45.7,48.7 51.3,54.3 77.2,28.5 77.2,37.2 85.2,37.2 85.2,14.9 62.8,14.9 62.8,22.9 71.5,22.9"></polygon></svg> <span class="sr-only">(opens new window)</span></span></div> <!----> <blockquote>部分文章中使用了一些网站的截图，如果涉及侵权，请告诉我删一下谢谢~</blockquote> <div style="margin-top:30px;"><div class="el-row" style="margin-left:-10px;margin-right:-10px;"><div class="el-col el-col-24 el-col-sm-0 el-col-md-2 el-col-lg-4" style="padding-left:10px;padding-right:10px;display:block;"><div style="width:1px;height:1px;"></div></div> <div class="el-col el-col-24 el-col-sm-24 el-col-md-18 el-col-lg-16" style="padding-left:10px;padding-right:10px;"><div class="el-card box-card is-always-shadow"><div class="el-card__header"><div class="clearfix"><span>温馨提示喵</span></div></div><div class="el-card__body"> <div class="el-row" style="margin-left:-10px;margin-right:-10px;"><div class="el-col el-col-24 el-col-xs-24 el-col-sm-12" style="padding-left:10px;padding-right:10px;"><div class="el-image"><div class="image-slot"><img src="https://github-imglib-1255459943.cos.ap-chengdu.myqcloud.com/assets/img/loading.gif" style="width:100%;"></div><!----></div></div> <div class="el-col el-col-24 el-col-xs-24 el-col-sm-12" style="padding-left:10px;padding-right:10px;"><div class="copyright-text"><div>本文版权归作者所有，欢迎转载，但未经作者同意必须保留此段声明，且在文章页面明显位置给出原文连接，否则保留追究法律责任的权利。</div> <div>出处：被删的前端游乐场</div> <div>作者：<a href="https://github.com/godbasin" target="_blank">被删</a></div></div></div></div></div></div></div></div></div></footer> <div class="page-nav"><p class="inner"><span class="prev">
        ←
        <a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20200214.html" class="prev">
          小程序开发月刊第13期（20200214）
        </a></span> <span class="next"><a href="/front-end-playground/wxapp/wxapp-latest/wxapp-latest-20200415.html">
          小程序开发月刊第15期（20200415）
        </a>
        →
      </span></p></div>  <div class="gitalk-container theme-default-content"><div id="gitalk-container" class="content"></div></div></main> <div id="kitty-container"><span><div role="tooltip" id="el-popover-4089" aria-hidden="true" class="el-popover el-popper" style="width:undefinedpx;display:none;"><!----><img src="https://github-imglib-1255459943.cos.ap-chengdu.myqcloud.com/2code2.jpg" class="image"> <div class="text">牡羊猪的猫粮罐</div> </div><span class="el-popover__reference-wrapper"><div id="kitty" style="background:url(https://github-imglib-1255459943.cos.ap-chengdu.myqcloud.com/assets/img/kitty1.svg);"></div></span></span> <div class="el-dialog__wrapper" style="display:none;"><div role="dialog" aria-modal="true" aria-label="牡羊猪是这样渐渐胖成猪的喵（点击图片可以切换噢）" class="el-dialog" style="margin-top:15vh;"><div class="el-dialog__header"><span class="el-dialog__title">牡羊猪是这样渐渐胖成猪的喵（点击图片可以切换噢）</span><button type="button" aria-label="Close" class="el-dialog__headerbtn"><i class="el-dialog__close el-icon el-icon-close"></i></button></div><!----><!----></div></div></div></div><div class="global-ui"></div></div>
    <script src="/front-end-playground/assets/js/app.1e2670bf.js" defer></script><script src="/front-end-playground/assets/js/2.38d016d1.js" defer></script><script src="/front-end-playground/assets/js/3.e3f029cb.js" defer></script><script src="/front-end-playground/assets/js/170.c1dc065a.js" defer></script>
  </body>
</html>
